<template>
<div class="">
  <head title="Categories"></head>
  <scroller class="wrapper">
    <text
      class="listItem"
      v-for="(item,index) in cateList"
      :key="index"
      @click="select(item)"
    >{{item.name}}</text>
  </scroller>
  <div class="maskClack" @click="e=>e.stopPropagation()" v-if="isLoading">
    <floading class="indicator" color="#303030"></floading>
  </div>
</div>
</template>

<script>
import { get_category_list } from "../../mixin/ajax.js";

export default {
  data() {
    return {
      cateList: []
    };
  },
  methods: {
    onLoad(parmar) {
      get_category_list({ type: 2, parentid: 0 }, (res, flag) => {
        if (res.code == 200) {
          this.cateList = res.data;
        }
      });
    },
    select(item) {
    
      const selectCategary = new BroadcastChannel("selectCategary");
      selectCategary.postMessage(item);
      this.back();
    }
  }
};
</script>

<style scoped>
.wrapper{
  flex: 1;
}
.listItem {
  width: 750px;
  height: 100px;
  padding-left: 32px;
  line-height: 100px;
  font-size: 30px;
  border-bottom-color: #e6e6e6;
  border-bottom-style: solid;
  border-bottom-width: 1px;
}
</style>
